package org.jetnuke.dao.sqlserver;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import net.jforum.JForumExecutionContext;
import net.jforum.util.preferences.SystemGlobals;

public class SqlServerReviewsDAO extends org.jetnuke.dao.generic.GenericReviewsDAO {

	public List selectOrderDateDesc(int limit) throws Exception {
		PreparedStatement p;
		
		String q1 = SystemGlobals.getSql("GenericModel.selectByLimit");
		String q2 = SystemGlobals.getSql("ReviewModel.selectOrderDateDesc");
		p = JForumExecutionContext.getConnection().prepareStatement(q1+" "+limit+" "+q2);
		
		ResultSet rs = p.executeQuery();
		List list = this.processSelectAll(rs);
		rs.close();
		p.close();
		
		return list;
	}
	public List selectOrderHitsDesc(int limit) throws Exception {
		PreparedStatement p;
		
		String q1 = SystemGlobals.getSql("GenericModel.selectByLimit");
		String q2 = SystemGlobals.getSql("ReviewModel.selectOrderHitsDesc");
		p = JForumExecutionContext.getConnection().prepareStatement(q1+" "+limit+" "+q2);
		
		ResultSet rs = p.executeQuery();
		List list = this.processSelectAll(rs);
		rs.close();
		p.close();
		
		return list;
	}
	public List selectOrderIDDesc(int limit) throws Exception {
		PreparedStatement p;
		
		String q1 = SystemGlobals.getSql("GenericModel.selectByLimit");
		String q2 = SystemGlobals.getSql("ReviewModel.selectOrderIDDesc");
		p = JForumExecutionContext.getConnection().prepareStatement(q1+" "+limit+" "+q2);
		
		ResultSet rs = p.executeQuery();
		List list = this.processSelectAll(rs);
		rs.close();
		p.close();
		
		return list;
	}
}
